using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Windows.Forms;

namespace Betarium.PotonEditor
{
	public class ToolInfoSpuit : ToolInfo
	{
		public ToolInfoSpuit(EditViewForm form)
			: base(form)
		{
		}

		public override void OnMouseDown(object sender, MouseEventArgs e)
		{
			m_Form.SelectState.OnMouseDown(sender, e);
			if (e.Button == MouseButtons.Left)
			{
				Point pos = m_Form.SelectState.MouseCurrentPos;
				if (new Rectangle(Point.Empty, m_Form.Image.Size).Contains(pos))
				{
					Color color = m_Form.Image.GetPixel(pos.X, pos.Y);
					m_Form.PaintState.MainColor = color;
					MainForm mainForm = (MainForm)m_Form.MdiParent;
					mainForm.ColorPalette.SetColor(PaletteForm.Pos.Main, color);
				}
			}
		}
		public override void OnMouseUp(object sender, MouseEventArgs e)
		{
			m_Form.SelectState.OnMouseUp(sender, e);
		}
		public override void OnMouseMove(object sender, MouseEventArgs e)
		{
			m_Form.SelectState.OnMouseMove(sender, e);
			Point pos = m_Form.SelectState.MouseCurrentPos;
			if (new Rectangle(Point.Empty, m_Form.Image.Size).Contains(pos))
			{
				m_Form.Cursor = Cursors.Default;
			}
			else
			{
				m_Form.Cursor = Cursors.No;
			}
		}
	}
}
